<template>
  <!-- 再次下发 -->
  <div class="task-inf">
    <div class="task-inf-fromed">
      <el-form ref="elForm3" :model="formData3" :rules="rules3" size="medium" label-width="120px">
        <el-row :gutter="15">
          <el-col :span="24">
            <el-row :gutter="15">
              <el-col :span="24">
                <el-form-item label="执行方式：" prop="zxfs">
                  <el-radio-group v-model="formData3.zxfs">
                    <el-radio label="1" name="1">立即执行</el-radio>
                    <el-radio label="2" name="2">定期执行</el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>
        </el-row>
        <el-row v-if="formData3.zxfs == 2" :gutter="15">
          <el-col :span="24">
            <el-row :gutter="15">
              <el-col :span="24">
                <el-form-item label="执行日期：" prop="zxrq">
                  <el-date-picker
                    v-model="formData3.zxrq"
                    :style="{width: '100%'}"
                    type="datetime"
                    placeholder="选择日期"
                  ></el-date-picker>
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>
        </el-row>
      </el-form>
    </div>
    <div class="task-inf-btn">
      <el-button type="primary" @click="issued" class="centerbox">任务下发</el-button>
    </div>
  </div>
</template>

<script lang="ts">
import { Component, Vue, Prop } from "vue-property-decorator";

@Component
export default class taskissued extends Vue {
  @Prop() datas!: any[];
  public formData3 = {
    zxfs: "",
    zxrq: "",
  };
  public rules3 = {
    zxfs: [],
    zxrq: [],
  };
  issued() {
    let zxfs = this.formData3.zxfs;
    if (zxfs == "") {
      this.$message({
        type: "warning",
        message: "请勾选执行方式",
      });
      return;
    }
    let params = {
      czzt: "send",
      bdzid: this.datas[0].BDZID,
      xjlx: this.datas[0].XJLX,
      rwid: this.datas[0].RWID,
      sendType: this.formData3.zxfs === "1" ? "lj" : "dq",
    };

    (this as any).$services
      .xzrwRwxfButton({ data: { xzrwParam: params },
          method: "post",
          postparams: true, })
      .then((result: any) => {
        if (result.data) {
          this.$message({
            type: "success",
            message: "任务下发成功!",
          });
          this.$emit("close");
        }
      })
      .catch((err: object) => {
        console.log(err);
      });
  }
}
</script>

<style lang="scss" scoped>
.fromed {
  width: 100%;
  height: 100%;
  padding: 0.25rem 0;
}

.task-inf {
  width: 100%;
  height: 100%;
  padding: 0.25rem 0;
  &-fromed {
    width: 50%;
    margin: auto;
    height: 400px;
  }
  &-btn {
    width: 100%;
    display: flex;
    justify-content: flex-end;
  }
}
</style>
